package com.xiaohai.big_event_system.projo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 分类
 * </p>
 *
 * @author author
 * @since 2025-01-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("category")
public class Category implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @NotNull(groups = Update.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 分类名称
     */
//    @NotEmpty(groups = {Update.class, Add.class})
    @NotEmpty
    @TableField("category_name")
    private String categoryName;

    /**
     * 分类别名
     */
//    @NotEmpty(groups = {Update.class, Add.class})
    @NotEmpty
    @TableField("category_alias")
    private String categoryAlias;

    /**
     * 创建人id
     */
    @TableField("create_user")
    private Integer createUser;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "YYYY-MM-DD hh:mm:ss")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "YYYY-MM-DD hh:mm:ss")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 是否删除
     */
    @JsonIgnore
    @TableField(value = "is_delete", fill = FieldFill.INSERT)
    private Integer isDelete;

//    public interface Add {
//    }
//
//    public interface Update {
//    }

    // 如果某个校验没有指定分组，默认输入Default组
    // 分组之间可以被继承，Add extends Default 那么Add组会包含Default组的校验
    public interface Add extends Default {
    }

    public interface Update extends Default {
    }
}
